package com.cy.pj.goods.dao;

import com.cy.pj.goods.pojo.Goods;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

@Repository
public class GoodsDaoimpl  implements GoodsDao{
    @Autowired
    SqlSessionFactory sqlSessionFactory;

    @Override
    public List<Goods> findGoods() throws SQLException {
       SqlSession sqlSession= sqlSessionFactory.openSession();
       String statement="com.cy.pj.goods.dao.GoodsDao.findGoods";
       List<Goods>goodsList= sqlSession.selectList(statement);
       sqlSession.close();
       return goodsList;
    }
}
